package com.ganbo.pattern.decorator;

/**
 * Created by gan on 2020/12/5 23:27.
 */
public class EggDecorator extends BattercakeDecorator {
    public EggDecorator(Battercake battercake) {
        super(battercake);
    }


    @Override
    protected String getMsg() {
        return super.getMsg() + " +1 个鸡蛋,";
    }

    @Override
    public int getPrice() {
        return super.getPrice() + 1;
    }

    public static void main(String[] args) {
        Battercake battercake = new BaseBattercake();
        BattercakeDecorator b = new EggDecorator(battercake);
        System.out.println(b.getMsg() + "===>" + b.getPrice());
        b = new EggDecorator(b);

        System.out.println(b.getMsg() + "===>" + b.getPrice());
    }
}
